<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script type="text/javascript">
	var aaa = (function (){
		var a = 1;

		function bbb(){
			a++;
			alert(a);
		}
		function ccc(){			//a是局部变量，bbb和ccc是它的方法
			a++;
			alert(a);
		}

		return {
			b : bbb,
			c : ccc
		}
	})();

	aaa.b();		//2
	aaa.c();		//3

	//以下均会报错
	// alert(a);
	// alert(bbb);
	// alert(ccc);
	</script>
</body>
</html>